<template>
  <view>
    <u-popup :show="show"  mode="bottom"  :round="10" bgColor="#F6F7FB">
       <view class="popDialog">
         <view class="flex">
           <text class="c-95" @click="close()">取消</text>
           <view class="font-32 text-bold title flex-1">选择售后类型</view>
           <text class="color-title2" @click="confirm()">确定</text>
         </view>
          <scroll-view scroll-y="true" class="scrollH">
            <view class="time" :class="current==1?'on':''" @click="selectRefundType(1)">退款无需退货</view>
            <view class="time" :class="current==2?'on':''" v-if="refundType.length == 2" @click="selectRefundType(2)">退货退款</view>
          </scroll-view>
       </view>
     </u-popup>
  </view>
</template>

<script>
  export default {
    name:"refundType",
    props: {
      show: {
        type: Boolean,
        default: false
      },
      refundType: {
        type: Array,
        default: () => []
      }
    },
    data() {
      return {
        current: 1,
      };
    },
    created() {
      console.log("8888",this.refundType)
    },
    methods: {
      close() {
        this.$emit("close")
      },
      confirm() {
        let name = this.current == 1 ? '退款无需退货' : '退货退款';
        this.$emit("confirm",{
          name: name,
          type: this.current
        })
      },
      selectRefundType(type) {
        this.current = type;
      },
    }
  }
</script>

<style lang="scss" scoped>
.popDialog {
  width: 100%;
  padding: 40rpx 30rpx;
  border-radius: 20rpx 20rpx 0 0;
  box-sizing: border-box;
  .title {
    text-align: center;
  }
  .scrollH {
    height: 200rpx;
    margin-top: 80rpx;
    margin-bottom: 40rpx;
    
    .time {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      height: 75rpx;
      border-radius: 20rpx;
      margin-bottom: 30rpx;
      background-color: #fff;
      color: #5F6680;
    }
    .on {
      color: #fff!important;
      background-color: $color-title2!important;
    }
  }
}
</style>